package com.hardy.demo.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Author: Hardy
 * Date:   2021/3/11
 * Description:
 **/
public class JdkProxyUserOption implements InvocationHandler {

    private Option o;

    public JdkProxyUserOption(Option o) {
        this.o = o;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("调用之前：" + proxy.getClass().getName() + "::" + method.getName());
        Object result = method.invoke(o, args);
        System.out.println("调用之后：" + proxy.getClass().getName() + "::" + method.getName());
        System.out.println("-------------------------------------");
        return result;
    }
}
